<template>
	<view>
		<view class="presonBox" v-for="item in list" :key="item.id">
			<view class="name">
				<view class="name_box">
					<view class="name_content">
						<p>姓名</p>
					</view>
					<view class="name_text">
						<p>{{item.name}}</p>
					</view>
				</view>
			</view>
			<view class="name">
				<view class="name_box">
					<view class="name_content">
						<p>姓别</p>
					</view>
					<view class="name_text">
						<p>{{item.Gender}}</p>
					</view>
				</view>
			</view>
			<view class="name">
				<view class="name_box">
					<view class="name_content">
						<p>年龄</p>
					</view>
					<view class="name_text">
						<p>{{item.age}}</p>
					</view>
				</view>
			</view>
			<view class="name">
				<view class="name_box">
					<view class="name_content">
						<p>身份证号</p>
					</view>
					<view class="name_text">
						<p v-show="idNumberpass">{{item.teacherid1}}</p>
						<p v-show="idNumber">{{item.teacherid}}</p>
					</view>
				</view>
			</view>
			<view class="name">
				<view class="name_box">
					<view class="name_content">
						<p>联系电话</p>
					</view>
					<view class="name_text">
						<p v-show="passphone">{{item.dian1}}</p>
						<p v-show="phone">{{item.dian}}</p>
					</view>
				</view>
			</view>
			<view class="name">
				<view class="name_box">
					<view class="name_content">
						<p>证书编号</p>
					</view>
					<view class="name_text">
						<p v-show="passcert">{{item.idnum1}}</p>
						<p v-show="certificateNum">{{item.idnum}}</p>
					</view>
				</view>
			</view>
			<view class="name">
				<view class="name_box">
					<view class="name_content">
						<p>专业领域</p>
					</view>
					<view class="name_text">
						<p>{{item.major}}</p>
					</view>
				</view>
			</view>
			<view class="btn">
				<button @click="show4 = true">查看详细资料(￥10.00)</button>
			
					<u-modal
							:content="content"
							:show="show4"
							showCancelButton
							asyncClose
							@confirm="confirm4"
							@cancel="() => show4 = false"
						></u-modal>
					
				
				
				
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:null,
				list:[],
				idNumberpass:true,
				idNumber:false,
				passphone:true,
				phone:false,
				passcert:true,
				certificateNum:false,
				title:'标题',
				content:'确定要消费10元大洋吗?',
				show4: false,
				FileList:[],
			}
		},
		onLoad(options) {
		this.$api.searchTutor2(options).then(res=>{
			console.log(res)
			this.list=res.data
		}),
		this.$api.getpsxintegral().then(res=>{
			this.FileList=res.data
			console.log(this.FileList[0].momeny)
		})
		},
		methods: {
		confirm4() {
					setTimeout(() => {
						if(this.FileList[0].momeny>10){
						this.show4 = false
						this.idNumber=true
						this.idNumberpass=false
						this.passcert=false
						this.passphone=false
						this.phone=true
						this.certificateNum=true
				this.FileList.forEach(item=>{
					let a={id:item.id,momeny:item.momeny-10}
					this.$api.putpsxintegral(a).then(res=>{
						uni.showToast({
							title: '支付成功',
							icon: 'true'
						})
						this.$api.getpsxintegral().then(res=>{
							this.FileList=res.data
							console.log(this.FileList[0].momeny)
						})
						let b={
							detil:'-10',
							title:'报名',
							text:'余额'
						}
						this.$api.addpsxdetil(b)
					})
				})
						
				}else{
					uni.showToast({
						icon: 'false',
						title: '余额不足',
					})
					this.show4 = false
				}	}, 1000)
				},
		}
	}
</script>

<style>
	page {
		background-color: #ddd;
	}

	.presonBox {
		width: 100%;
		height: 950upx;
	}

	.presonBox .name {
		width: 100%;
		height: 90upx;
		background-color: #fafafa;
		margin-bottom: 20upx;
	}
	.presonBox .name_box{
		width: 90%;
		margin: 0 auto;
		height: 90upx;
		display: flex;
	}
	.name_content{
		width: 250upx;
		height: 90upx;
		line-height: 90upx;
		color: #333;
		font-size: 30upx;
	}
	.name_text{
		width: 430upx;
		height: 90upx;
		line-height: 90upx;
		color: #333;
		font-size: 30upx;
	}
	.btn{
		width: 70%;
		height: 80upx;
		margin: 90upx auto 0;
	}
	.btn button{
		height: 80upx;
		font-size: 26upx;
		line-height: 80upx;
		color: #fafafa;
		background-color: #8fc31f;
	}
</style>
